package org.telegram.bot.emums;

import org.telegram.bot.domain.BotStartApp;

/**
 * @Author: wyx
 * @Date: 2024/11/20 0:01
 */
public class BotCommonEnums {
    //地址常量
    public static final String BOT_BASE_API = "https://t.me/";
    public static final String BOT_TELEGRAM_URL= "https://t.me/";
    
    /*聊天类型*/
    public static final String CHAT_TYPE_PRIVATE = "private";//私有
    public static final String CHAT_TYPE_GROUP = "group";//组
    public static final String CHAT_TYPE_SUPERGROUP = "supergroup";//公开超级组
    public static final String CHAT_TYPE_CHANNEL = "channel";//频道
    
    /*群管理、创建人角色*/
    public static final String CHAT_ROLE_ADMINISTRATOR = "administrator";//管理员
    public static final String CHAT_ROLE_ADMIN = "creator";//创始人
    public static final String CHAT_ROLE_GROUP_ANONYMOUS_BOT = "GroupAnonymousBot";//tg匿名群账号
    public static final String CHAT_ROLE_GROUP_MEMBER = "member";//成员
    
    /*群事件*/
    public static final String CHAT_EVENT_MEMBER = "member";//变更为成员
    public static final String CHAT_EVENT_LEFT = "left";//退出群组
    public static final String CHAT_EVENT_KICKED = "kicked";//被踢出群组
    public static final String CHAT_EVENT_ADMINISTRATOR = "administrator";//升级为管理员
    public static final String CHAT_EVENT_RESTRICTED = "restricted";//机器人权限发送改变
    
    /*部门、角色、*/
    public static final Long DEFAULT_DEPT_ID = 101L;
    public static final Long DEFAULT_ROLE_ID = 3L;
    
    /**
     * 网页插件
     */
    public static final String ROUTER_VERIFY = "/html/verify.html";
    
    /**菜单按钮键值**/
    public static final String KEYBOARD_CONTENT = "content";
    public static final String KEYBOARD_BUTTONROWS = "buttonRows";
    
    /**
     * 消息实体类型
     */
    public static final String MESSAGE_ENTITY_CUSTOM_EMOJI = "custom_emoji";
    public static final String MESSAGE_ENTITY_TEXT_LINK = "text_link";
    public static final String MESSAGE_ENTITY_BOT_COMMAND = "bot_command";
    /**
     *
     * @param botName
     * @param appName
     * @param startApp
     * @param isFullscreen
     * @return
     */
    public static StringBuilder getWebApp(String botName, String appName, BotStartApp startApp,Boolean isFullscreen){
        StringBuilder sb = new StringBuilder().append(BOT_BASE_API).append(botName).append("/").append(appName);
        String prefix = "?";
        if(startApp!=null){
            sb.append("?startapp=").append(startApp);
            prefix = "&";
        }
        if(!isFullscreen){
            sb.append(prefix).append("mode=compact");
        }
        return sb;
    }
    
    /**
     *
     * @param botName
     * @param appName
     * @return
     */
    public static StringBuilder getWebApp(String botName, String appName){
        return getWebApp(botName,appName,null,true);
    }
    
    /**
     *
     * @param botName
     * @param appName
     * @param startApp
     * @return
     */
    public static StringBuilder getWebApp(String botName, String appName,BotStartApp startApp){
        return getWebApp(botName,appName,startApp,true);
    }
}
